//引入VueRouter
import VueRouter from 'vue-router'

//注册组件
import HomePage from '../components/home/HomePage.vue'
import HotListPage from '../components/home/card/HotListCard.vue'
import SocialCard from '../components/home/card/SocialCard.vue'
import AnimationPage from '../components/dataPage/AnimationPage.vue'
import DetailPage from '../components/dataPage/DetailPage.vue'
import IssueEditorPage from '../components/issuePage/IssueEditorPage.vue'
import PersonPage from '../components/personal/PersonPage.vue'
import IssueCard from '../components/personal/card/IssueCard.vue'
import CommentCard from '../components/personal/card/CommentCard.vue'
import CriticismCard from '../components/personal/card/CriticismCard.vue'
import MessageCard from '../components/personal/card/MessageCard.vue'
import ContentDetail from '../components/detailPage/ContentDetail.vue'
import SerachResult from '../components/searchPage/SearchResult.vue'
import LoginPage from '../components/user/LoginPage'
import WeekLyBangumi from '../components/home/WeeklyBangumi'
import AboutPage from '../components/about/AboutPage'


//创建路由的实例对象
const router = new VueRouter({
    routes: [
        {
            path: '/',
            redirect: '/HomePage'
        },
        //主页
        {
            path: '/HomePage',
            name: 'home',
            component: HomePage,
            meta: {
                keepAlive: true
            },
            redirect: '/HomePage/HotListCard',
            children: [
                {
                    path: 'HotListCard',
                    component: HotListPage,
                    meta: {
                        title: "主页/热门",
                        keepAlive: true
                    }
                },
                {
                    path: 'SocialCard',
                    component: SocialCard,
                    meta: {
                        title: "主页/社区",
                        keepAlive: true
                    }
                },
            ]
        },
        //番剧更新详情页
        {
            path: '/WeekLyBangumi',
            component: WeekLyBangumi,
        },
        //番剧主页 
        {
            path: '/AnimationPage',
            component: AnimationPage,
            meta: {
                keepAlive: true
            }
            // redirect:'/AnimationPage',
        },
        //番剧详情 
        {
            path: '/DetailPage',
            component: DetailPage,
            // redirect:'/AnimationPage',
        },
        //编辑页面
        {
            path: '/IssueEditorPage',
            component: IssueEditorPage,
        },
        //个人主页
        {
            path: '/PersonPage',
            component: PersonPage,
            redirect: '/PersonPage/IssueCard',
            children: [
                {
                    path: 'IssueCard',
                    name: "issue",
                    component: IssueCard,
                    meta: {
                        keepAlive: true
                    }
                },
                {
                    path: 'CommentCard',
                    name: "comment",
                    component: CommentCard,
                    meta: {
                        keepAlive: true
                    }
                },
                {
                    path: 'CriticismCard',
                    name: "criticism",
                    component: CriticismCard,
                    meta: {
                        keepAlive: true
                    }
                },
                {
                    path: 'MessageCard',
                    name: "message",
                    component: MessageCard,
                    meta: {
                        keepAlive: true
                    }
                },
            ],
        },
        //详情页面
        {
            path: '/ContentDetail',
            component: ContentDetail,
        },
        //搜索结果页面
        {
            path: '/SearchResult',
            component: SerachResult,
        },
        //登录&&注册
        {
            path: '/Login',
            component: LoginPage,
        },
        //关于页面
        {
            path: '/About',
            component: AboutPage,
        }
    ]

})

//暴露 
export default router